package com.xb.cloud.merchantapi.adapter;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.xb.cloud.gateway.client.Adapter;
import com.xb.cloud.gateway.client.AdapterContext;
import com.xb.cloud.gateway.client.RtnInfo;
import com.xb.cloud.merchantapi.product.service.CategoryApiService;

/**
 * 
 * @author: 鲜备科技
 * @date: 2017年12月19日 下午6:30:04
 * 
 * @Copyright: 2017 www.xianbeitech.com Inc. All rights reserved.
 *
 */
@Component
public class CategoryApiAdapter extends Adapter {
	
	private static final Logger logger = LoggerFactory.getLogger(ProductPublishApiAdapter.class);
	
	@Autowired
	private CategoryApiService categoryApiService;
	
	/**
	 * 	获取类目信息
	 */
	public RtnInfo execute(String urlPath, Boolean isLogined, Map<String, String> bizInfo, AdapterContext context) {
		RtnInfo rtnInfo = null;
		 
		if ("/h5/merchant/category/getCategoryBoTreeByCompanyId".equalsIgnoreCase(urlPath)) {
			 
			/**
			 * 参数验证
			 */
			rtnInfo = categoryApiService.getCategoryBoTreeByCompanyId(context.getCompanyId());
			// 获取 数据
		}
		
		return rtnInfo;
	}

	@Override
	public String getUrlMappingPath() {
		return "/h5/merchant/category/**";
	}

	@Override
	public boolean isCheckUserToken() {
		return true;
	}
}
